<?php
include("../class/pData.class.php");
include("../class/pDraw.class.php");
include("../class/pImage.class.php");

$myData = new pData();
$myData->addPoints(array(1,4,3,2,3,3,2,1,0,7,4,3,2,3,3,5,1,0,7));
$myData->setSerieDescription("Serie1","sample");
$myData->setSerieOnAxis("Serie1",0);

$myPicture = new pImage(700,230,$myData);

//画格子和标签
$myPicture->setGraphArea(40,30,680,200);
$myPicture->setFontProperties(array("FontName"=>"fonts/tahoma.ttf","FontSize"=>10));
$Settings = array(
	"Mode"=>SCALE_MODE_ADDALL_START0, 
	"GridR"=>150, 
	"GridG"=>150, 
	"GridB"=>150, 
	"XMargin"=>0, 
	"YMargin"=>0,
	"GridTicks"=>2,  //格子密度
	"MinDivHeight"=>40
	);
$myPicture->drawScale($Settings);

//画线
$Config = "";
$myPicture->drawLineChart($Config);

//$Config = array("R"=>255, "G"=>255, "B"=>255);
//画点
//$myPicture->drawPlotChart($Config);
//底层加色
$myPicture->drawStackedAreaChart(array("LineAlpha"=>255));

//提示
//$myPicture->setFontProperties(array("FontName"=>"fonts/tahoma.ttf","FontSize"=>8));
$Config = array("R"=>255, "G"=>255, "B"=>255, "FontName"=>"fonts/tahoma.ttf", "FontSize"=>8, "Margin"=>0, "Alpha"=>0, "BoxSize"=>5, "Style"=>LEGEND_NOBORDER
);
$myPicture->drawLegend(45,35,$Config);

//标题
//$myPicture->setFontProperties(array("FontName"=>"fonts/tahoma.ttf","FontSize"=>10));
$TextSettings = array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE
, "R"=>50, "G"=>50, "B"=>50,"FontName"=>"fonts/tahoma.ttf","FontSize"=>10);
$myPicture->drawText(350,25,"iApollo Chart",$TextSettings);

$myPicture->stroke();
?>